#jx_js({path:jxwebpath.js,file:"codemirror/lib/codemirror.js,codemirror/mode/css/css.js,codemirror/mode/htmlembedded/htmlembedded.js,codemirror/mode/htmlmixed/htmlmixed.js,codemirror/mode/javascript/javascript.js,codemirror/mode/vue/vue.js,codemirror/mode/xml/xml.js"})
#jx_css({file:"codemirror.css"})
<script>
    seajs.use(["jquery","json2"], function ($)
    {
      var j_ed_code = [] ;
      $(function()
      {
        var j_code_config = {
          lineNumbers: true,
            styleActiveLine:true,
            matchBrackets: true,
            indentUnit:2,
            lineWrapping: true,
            extraKeys: {// Tab键换成4个空格
                        Tab: function(cm) {var spaces = Array(cm.getOption("indentUnit") + 1).join(" ");cm.replaceSelection(spaces);}
                        }
          };
        $("textarea").each(function ()
        {
          if (undefined == $(this).attr("jcm_id"))
            return true; 
          
          if (undefined != $(this).attr("jcm_cfg"))
            j_code_config = $.extend(true, {}, j_code_config, JSON.parse($(this).attr("jcm_cfg")));
          $(this).attr("id", $(this).attr("jcm_id")) ;
          j_ed_code.push(CodeMirror.fromTextArea(document.getElementById($(this).attr("jcm_id")), j_code_config));
          
        });
      });
      function j_codesave()
      {
        for (var i=0; i<j_ed_code.length;i++)
          j_ed_code[i].save() ;
      } 
      window.j_codesave = j_codesave ;
    });
</script>